<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.cqggrw.util.*"%>
<%@ page import="com.alibaba.fastjson.*"%>
<%@ page import="com.cqggrw.domain.*"%>
<%@ page import="com.cqggrw.service.*"%>
<%@ page import="com.cqggrw.service.impl.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ path + "/";
	AdServiceI adService = new AdServiceImpl();
	List<Ad> adList = adService.get();
	Map<Integer, Ad> adMap = new HashMap<Integer, Ad>();
	for(Ad ad : adList) {
		adMap.put(ad.getId(), ad);
	}
%>
<%
	String idStr = request.getParameter("id");
	String CategoryName = null;
	if (idStr != null) {
		Connection conn = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
	
		String sql = "select * from tbl_category where id = ?;";
		try {
	conn = DBUtil.getConn();
	ps = conn.prepareStatement(sql);
	ps.setInt(1, Integer.parseInt(idStr));
	rs = ps.executeQuery();
	if(rs.next()) {
		CategoryName = rs.getString("name");
	}
		} catch (Exception e) {
	e.printStackTrace();
		} finally {
	DBUtil.close(conn, ps, rs);
		}
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>公共人物网</title>
<link href="css/common.css" type="text/css" rel="stylesheet" />
<link href="css/channel.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="jslib/jquery-1.8.0.min.js"> </script>
<script type="text/javascript" src="jslib/shouye.js"></script>
<script type="text/javascript">
    //获取页面传值的参数
    
    function GetQueryString(Sprop)
    {
        var re=new RegExp("&,?"+Sprop+"([^\\&]*)","i");
        var a=re.exec(document.location.search);
        if(a==null){
        return "";
        }
        else{
        return a[1];
        }
    }
    
   $(document).ready(function() {
     var cid="0";
    if(document.location.toString().split("_").length>1){
            cid=document.location.toString().split("_")[1].split(".")[0];
            }
    return;
            $.ajax({
               type: "POST",  //访问WebService使用post方式请求
                contentType: "application/json;utf-8",   //WebService会返回json类型
                url: "Ajaxnewlist.aspx/Setnewlist", //调用WebService的地址和方法名称组合
                data: '{ cid:"' + cid + '"}',  //这里是要传递的参数，格式为data:"{paraName:paraValue}"                
                dataType: "json",
                success: function(result) {
                    $.each(result.d, function(i, item) {
                    $(".cont1_cont").append("<a target='_Blank' href=news/"+item.ID +".html title="+item.Title+"><span style='font-size:22px;font-weight:bold;line-height:40px;color:#FF0000;'>"+item.Title.toString().substring(0, item.Title.toString().length > 30 ? 30 : item.Title.toString().length)+"</span></a><br />"+item.Description.toString().substring(0, item.Description.toString().length > 100 ? 100 : item.Description.toString().length)+"...<br/>");
                    });

                },
                error: function(msg) {
                    alert("发送请求失败" + msg.responseText);
                }
            });        
       
        });
    
</script>
<style type="text/css">
#play {
	width: 347px;
	height: 384px;
	border: #ccc 1px solid;
}

#playBg {
	margin-top: 355px;
	z-index: 1;
	filter: alpha(opacity = 70);
	opacity: 0.7;
	width: 347px;
	position: absolute;
	height: 30px;
	background: #000;
}

#playText {
	margin-top: 355px;
	z-index: 2;
	padding-left: 10px;
	font-size: 14px;
	font-weight: bold;
	width: 240px;
	color: #fff;
	line-height: 30px;
	overflow: hidden;
	position: absolute;
	cursor: pointer;
}

#playNum {
	margin: 355px 5px 0 220px;
	z-index: 3;
	width: 120px;
	text-align: right;
	position: absolute;
	height: 25px;
}

#playNum a {
	margin: 0 2 5 2px;
	width: 15px;
	height: 30px;
	font-size: 14px;
	font-weight: bold;
	line-height: 20px;
	cursor: pointer;
	color: #000;
	padding: 0 5px;
	background: #D7D6D7;
	text-align: center
}

#playShow img {
	width: 347px;
	height: 384px;
	border: 0px;
}
</style>
</head>
<body onload="init()">
	<form name="form1" method="post" action="ggnews.aspx?id=44" id="form1">
		<div class="top">
			<div class="top1">
				<div class="logo">
					<h6>
						<span id="Label1"><%=CategoryName%></span>
					</h6>
				</div>
				<div class="times">
					每日小贴士：<span class="shijan"></span>
				</div>
			</div>
			<div class="menu">
				<a target="_blank" href="<%=basePath%>">公共人物首页</a> - <a target="_blank" href="news.jsp?id=13"><font color="#FF0000">焦点</font>
				</a> - <a target="_blank" href="news.jsp?id=2">关注</a> - <a target="_blank" href="news.jsp?id=4">达人</a> - <a target="_blank" href="news.jsp?id=14">教育</a> - <a target="_blank" href="news.jsp?id=3">精英领导</a> - <a target="_blank" href="news.jsp?id=28">区县</a> - <a target="_blank" href="news.jsp?id=26">观点</a> - <a target="_blank" href="news.jsp?id=2">公共</a> - <a target="_blank" href="news.jsp?id=21">文萃</a> - <a target="_blank" href="news.jsp?id=6">追寻</a> - <a target="_blank" href="news.jsp?id=10">访谈</a> - <a target="_blank" href="news.jsp?id=23">环球</a> - <a target="_blank" href="news.jsp?id=25">体育</a>- <a target="_blank" href="news.jsp?id=29">图说天下</a>
			</div>
		</div>
		<div class="banner">
			<a target="_blank" href="<%=adMap.get(12).getLink()%>"><img src="images/AdImg/<%=adMap.get(12).getImgName()%>" /> </a>
		</div>
		<div class="content">
			<div class="cont1">
				<div class="tv">
					<div id="play">
						<ul>
							<li id="playBg"></li>
							<li id="playText"></li>
							<li id="playNum"><a>1</a> <a>2</a> <a>3</a></li>
							<li id="playShow">
								<%
									FlashserviceI flashService = new FlashserviceImpl();
								        			List<Flash> fList = flashService.getFlashImg(1);
								        			
								        			for(Flash flash : fList){
								%> <a target="_blank" href='<%=flash.getImgLink()%>' target="_blank" title='<%=flash.getName()%>'><img src='images/FlashImg/<%=flash.getImgUrl()%>' alt2='<%=flash.getName().length()<=10?flash.getName():flash.getName().substring(0, 10)%>'>
							</a> <%
 	}
 %>
							</li>
						</ul>
					</div>
					<script type=text/javascript>
            var t = n = 0, count = $("#playShow a").size();
            $(function(){
            $("#playShow a:not(:first-child)").hide();
            $("#playText").html($("#playShow a:first-child").find("img").attr('alt2'));
            $("#playNum a:first").css({"background":"#FFD116",'color':'#A8471C'});
            $("#playText").click(function(){window.open($("#playShow a:first-child").attr('href'), "_blank")});
            $("#playNum a").click(function() {
               var i = $(this).text() - 1;
               n = i;
               if (i >= count) return;
               $("#playText").html($("#playShow a").eq(i).find("img").attr('alt2'));
               $("#playText").unbind().click(function(){window.open($("#playShow a").eq(i).attr('href'), "_blank")})
               $("#playShow a").filter(":visible").hide().parent().children().eq(i).fadeIn(2400);
               $(this).css({"background":"#FFD116",'color':'#A8471C'}).siblings().css({"background":"#D7D6D7",'color':'#000'});
            });
            t = setInterval("showAuto()", 5000);
            $("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 5000);});
            })
            function showAuto()
            {
            n = n >= (count - 1) ? 0 : ++n;
            $("#playNum a").eq(n).trigger('click');
            }
            </script>
				</div>
				<div class="cont1_cont">
					<%
						NewsServiceI<News> service = new NewsServiceImpl();
						List<News> newsForId = service.getByTypeId(Integer.parseInt(idStr));
						for (int i = 0; i < 4 && i < newsForId.size(); i++) {
					%>
					<a target='_Blank' href="news/news.jsp?id=<%=newsForId.get(i).getId()%>" title="<%=newsForId.get(i).getName()%>"><span style='font-size:22px;font-weight:bold;line-height:40px;color:#FF0000;'><%=newsForId.get(i).getName().length() <= 25 ? newsForId.get(i).getName() : newsForId.get(i).getName().substring(0, 25)%></span>
					</a><br /><%=newsForId.get(i).getTxtContent().length() <= 100 ? newsForId.get(i).getTxtContent() : newsForId.get(i).getTxtContent().substring(0, 100)+"..."%><br />
					<%
						}
					%>
				</div>
			</div>
			<div class="clear"></div>
			<div id="div1show" class="cont2">
				<div class="focus">
					<div class="focus_title">
						新闻<span>焦点</span>
					</div>
					<div class="focus_cont">
						<div class="focus_cont_left">
							<%
								List<News> newsList13 = service.getByTypeId(13);
								for (int i = 0; i < 9 && i < newsList13.size(); i += 4) {
									if (i != 0) {
										out.println("<br/>");
									}
							%>
							<h3>
								<a target="_blank" href='news/news.jsp?id=<%=newsList13.get(i).getId()%>' class="a5"><span id="rptjiaodiannew1_ctl00_lbljiaodiantop" title="<%=newsList13.get(i).getName()%>"><%=newsList13.get(i).getName().length()<23 ? newsList13.get(i).getName() : newsList13.get(i).getName().substring(0, 23)%></span>
								</a>
							</h3>
							<br/>
							<ul>
								<li><a target="_blank" href='news/news.jsp?id=<%=newsList13.get(i + 1).getId()%>' class="a5">·<span id="rptjiaodiannew2_ctl00_lbljiaodiantop" title="<%=newsList13.get(i + 1).getName()%>"><%=newsList13.get(i + 1).getName().length()<23 ? newsList13.get(i + 1).getName() : newsList13.get(i + 1).getName().substring(0, 23)%></span>
								</a>
								</li>
								<li><a target="_blank" href='news/news.jsp?id=<%=newsList13.get(i + 2).getId()%>' class="a5">·<span id="rptjiaodiannew2_ctl00_lbljiaodiantop" title="<%=newsList13.get(i + 2).getName()%>"><%=newsList13.get(i + 2).getName().length()<23 ? newsList13.get(i + 2).getName() : newsList13.get(i + 2).getName().substring(0, 23)%></span>
								</a>
								</li>
								<li><a target="_blank" href='news/news.jsp?id=<%=newsList13.get(i + 3).getId()%>' class="a5">·<span id="rptjiaodiannew2_ctl00_lbljiaodiantop" title="<%=newsList13.get(i + 3).getName()%>"><%=newsList13.get(i + 3).getName().length()<23 ? newsList13.get(i + 3).getName() : newsList13.get(i + 3).getName().substring(0, 23)%></span>
								</a>
								</li>
							</ul>
							<%
								}
							%>
						</div>
						<div class="focus_cont_right">
							<%
								List<News> newsListHasImg = service.getListHasImgByType(13);
								for (int i = 0; i < 3 && i < newsListHasImg.size(); i++) {
							%>
							<ul>
								<li><a target="_blank" href='news/news.jsp?id=<%=newsListHasImg.get(i).getId()%>'><img src='images/img/<%=newsListHasImg.get(i).getFilename()%>' width="179" height="110" alt="" style='border:0px;' />
								</a>
								</li>
								<li><a target="_blank" href='news/news.jsp?id=<%=newsListHasImg.get(i).getId()%>' class="a5"><span id="rptjiaodiannew7_ctl00_lbljiaodiantop" title="<%=newsListHasImg.get(i).getName()%>"><%=newsListHasImg.get(i).getName().length() <= 14 ? newsListHasImg.get(i).getName() : newsListHasImg.get(i).getName().substring(0, 14)%></span>
								</a>
								</li>
							</ul>
							<%
								}
							%>
						</div>
					</div>
				</div>
				<div class="hot">
					<div class="hot1">
						<div class="focus_title">
							热门<span>焦点TOP10</span>
						</div>
						<ul>
							<%
								if (true) {
									Connection conn = null;
									PreparedStatement ps = null;
									ResultSet rs = null;

									String sql = "select * from tbl_news order by ckbtop desc limit 10;";
									int i = 1;
									try {
										conn = DBUtil.getConn();
										ps = conn.prepareStatement(sql);
										rs = ps.executeQuery();
										while (rs.next()) {
							%>
							<li><a target="_blank" href='news/news.jsp?id=<%=rs.getInt("id")%>'><font size="2" <%=i <= 3 ? "color=\"#FF0000\"" : ""%>><span id="rpthottopnew3_ctl00_lblboyitop" title="<%=rs.getString("name")%>"><%=rs.getString("name").length() <= 22 ? rs.getString("name") : rs.getString("name").substring(0, 22)%></span>
								</font>
							</a>
							</li>
							<%
								i++;
										}
									} catch (Exception e) {
										e.printStackTrace();
									} finally {
										DBUtil.close(conn, ps, rs);
									}
								}
							%>
						</ul>
					</div>
					<div class="ad1">
						<a target="_blank" href="<%=adMap.get(14).getLink()%>"><img src="images/AdImg/<%=adMap.get(14).getImgName()%>" /> </a>
					</div>
				</div>
			</div>
			<div id="div2show">
				<a target="_blank" href="<%=adMap.get(13).getLink()%>"><img src="images/AdImg/<%=adMap.get(13).getImgName()%>" /> </a>
			</div>
			<div class="cont3">
				<div class="media">
					<div>
						<img src="images/channel/ggrww_1_22.jpg" />
					</div>
					<div class="media_cont">
						<%
							List<News> newsList18 = service.getByTypeId(18);
						%>
						<div class="media_img">
							<a target="_blank" href='news/news.jsp?id=<%=newsList18.get(0).getId()%>'><img src='images/img/<%=newsList18.get(0).getFilename()%>' width="223" height="184" alt="" style='border:0px;' />
							</a>
						</div>
						<div class="media_cont1">
							<h3>
								<a target="_blank" href='news/news.jsp?id=<%=newsList18.get(0).getId()%>' class="a2"><span id="rptmingxinglirentop_ctl00_lblboyitop" title="<%=newsList18.get(0).getName()%>"><%=newsList18.get(0).getName()%></span>
								</a>
							</h3>
							<%=newsList18.get(0).getTxtContent().length() <= 95 ? newsList18.get(0).getTxtContent() : newsList18.get(0).getTxtContent().substring(0, 95)%>
						</div>
					</div>
					<div class="media_cont2">
						<ul>
							<%
								for (int i = 1; i <= 8 && i < newsList18.size(); i++) {
							%>
							<li><a target="_blank" href='news/news.jsp?id=<%=newsList18.get(i).getId()%>' class="a5"><span id="rptmingxinliren_ctl00_lblboyitop" title="<%=newsList18.get(i).getName()%>"><%=newsList18.get(i).getName().length() <= 30 ? newsList18.get(i).getName() : newsList18.get(i).getName().substring(0, 30)%></span>
							</a> <%=newsList18.get(i).getAddDate()%></li>
							<%
								}
							%>
						</ul>
					</div>
					<div class="more">
						<h3>
							<a target="_blank" href="MorePage.jsp?id=18" class="a5">更多>></a>
						</h3>
					</div>
				</div>
				<div class="life">
					<div class="life_title">
						<img src="images/channel/ggrww_1_29.gif" width="13" height="18" /> 生活汇点
					</div>
					<div class="life_cont">
						<%
							List<News> newsList24 = service.getByTypeId(24);
						%>
						<div class="life_img">
							<a target="_blank" href='news/news.jsp?id=<%=newsList24.get(0).getId()%>'><img src='<%=newsList24.get(0).getFilename() == null ? "" : "images/img/" + newsList24.get(0).getFilename()%>' width="148" height="148" alt="" style='border:0px;' />
							</a>
						</div>
						<div class="life_cont1">
							<h3>
								<a target="_blank" href='news/news.jsp?id=<%=newsList24.get(0).getId()%>'><span id="rptshenghuohuidiantop_ctl00_lbljiaodiantop" title="<%=newsList24.get(0).getName()%>"><%=newsList24.get(0).getName()%></span>
								</a>
							</h3>
							<%=newsList24.get(0).getTxtContent().length() <= 85 ? newsList24.get(0).getTxtContent() : newsList24.get(0).getTxtContent().substring(0, 85)%>...
						</div>
					</div>
					<div class="life_cont2">
						<ul>
							<%
								for (int i = 1; i <= 9 && i < newsList24.size(); i++) {
							%>
							<li><span style="float:right;"> <%=newsList24.get(i).getAddDate()%></span><a target="_blank" href='news/news.jsp?id=<%=newsList24.get(i).getId()%>'><span id="rptshenghuohuidian_ctl00_lbljiaodiantop" title="<%=newsList24.get(i).getName()%>"><%=newsList24.get(i).getName()%></span>
							</a>
							</li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
			</div>
			<div class="cont4">
				<div class="media">
					<div class="focus_title">
						热点<span>专题</span>
					</div>
					<div class="hot_cont1">
						<%
							List<News> newsList19 = service.getByTypeId(19);
						%>
						<div class="media_img">
							<a target="_blank" href='news/news.jsp?id=<%=newsList19.get(0).getId()%>'> <img src='images/img/<%=newsList19.get(0).getFilename()%>' width="221" height="147" alt="" style='border:0px;' />
							</a>
						</div>
						<div class="media_cont1">
							<h3>
								<a target="_blank" href='news/news.jsp?id=<%=newsList19.get(0).getId()%>' class="a5"><span id="rptredianzhauntitop_ctl00_lbljiaodiantop" title="<%=newsList19.get(0).getName()%>"><%=newsList19.get(0).getName()%></span>
								</a>
							</h3>
							<%=newsList19.get(0).getTxtContent().length() <= 75 ? newsList19.get(0).getTxtContent() : newsList19.get(0).getTxtContent().substring(0, 75)%>...
						</div>
					</div>
					<div class="media_cont2">
						<ul>
							<%
								for (int i = 1; i < newsList19.size() && i <= 4; i++) {
							%>
							<li><a target="_blank" href='news/news.jsp?id=<%=newsList19.get(i).getId()%>' class="a5">·<span id="rptredianzhaunti_ctl00_lbljiaodiantop" title="<%=newsList19.get(i).getName()%>"><%=newsList19.get(i).getName()%></span> </a> 2012-08-18</li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
				<div class="review">
					<div class="focus_title">
						要闻<span>回顾</span>
					</div>
					<div class="hot_cont1">
						<%
							List<News> newsList23 = service.getByTypeId(23);
						%>
						<div class="media_img">
						<a target="_blank" href='news/news.jsp?id=<%=newsList23.get(0).getId()%>'>
							<img src='images/img/<%=newsList23.get(0).getFilename()%>' width="221" height="147" alt="" style='border:0px;' /></a>
						</div>
						<div class="review_cont">
							<h3>
								<a target="_blank" href='news/news.jsp?id=<%=newsList23.get(0).getId()%>' class="a5"><span id="rptyapwenhuigutop_ctl00_lbljiaodiantop" title="<%=newsList23.get(0).getName()%>"><%=newsList23.get(0).getName()%></span>
								</a>
							</h3>
							<%=newsList23.get(0).getTxtContent().length() <= 57 ? newsList23.get(0).getTxtContent() : newsList23.get(0).getTxtContent().substring(0, 57)%>...
						</div>
					</div>
					<div class="media_cont2">
						<ul>
							<%
								for (int i = 1; i <= 4 && i < newsList23.size(); i++) {
							%>
							<li><a target="_blank" href='news/news.jsp?id=<%=newsList23.get(i).getId()%>' class="a5">·<span id="rptyapwenhuigu_ctl00_lbljiaodiantop" title="<%=newsList23.get(i).getName()%> "><%=newsList23.get(i).getName()%> </span> </a> <%=newsList23.get(i).getAddDate()%></li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
			</div>
			<div class="cont5">
				<div class="read">
					<div class="read_title">+ 推荐阅读</div>
					<div class="read_cont">
						<%
							if (true) {
								Connection conn = null;
								PreparedStatement ps = null;
								ResultSet rs = null;

								String sql = "select * from tbl_news order by ckbtop desc limit 10;;";
								try {
									conn = DBUtil.getConn();
									ps = conn.prepareStatement(sql);
									rs = ps.executeQuery();
									int i = 1;
									while (rs.next()) {
										if (i == 1)
											out.println("<ul class=\"read_cont1\">");
										if (i == 6)
											out.println(" </ul><ul>");
										if (i == 11)
											out.println("</ul>");
						%>
						<li><a target="_blank" href='news/news.jsp?id=<%=rs.getInt("id")%>' title='<%=rs.getString("name")%>'><%=rs.getString("name").length() <= 15 ? rs.getString("name") : rs.getString("name").substring(0, 15)%></a>
						</li>
						<%
							i++;
									}
								} catch (Exception e) {
									e.printStackTrace();
								} finally {
									DBUtil.close(conn, ps, rs);
								}
							}
						%>
					</div>
				</div>
				<div class="ad2">
					<a target="_blank" href="<%=adMap.get(15).getLink()%>"><img src="images/AdImg/<%=adMap.get(15).getImgName()%>" /> </a>
				</div>
			</div>
		</div>
		<div class="foot">
			<div class="links">
				<span>友情链接：</span>
				<%
					LinkServiceI linkService = new LinkServiceImpl();
					List<Link> links = (ArrayList<Link>) linkService.get();
					for (int i = 0; i < links.size(); i++) {
				%>
				<a target="_blank" href='<%=links.get(i).getUrl()%>'><%=links.get(i).getName()%></a>
				<%
					if (i < links.size() - 1)
							out.print("|");
					}
				%>
			</div>
			<div class="copyright">
				<div class="company">主办单位：重庆行政公共人物杂志社</div>
				<div class="map">
				<a href="about.jsp?id=1">关于我们</a> | <a href="about.jsp?id=2">杂志简介</a> | <a href="about.jsp?id=3">广告刊例</a> | <a href="about.jsp?id=4">组织机构</a> | <a href="about.jsp?id=5">联系我们</a> | <a href="about.jsp?id=6">本网声明</a> | <a href="about.jsp?id=7">版权声明</a>
			</div>
				<p>
					Copyright &copy; 2008-2012 www.cqggrw.com All Rights Reserved 渝ICP备12001034号-1&nbsp;&nbsp;技术支持：<a href="http://www.cqgew.com">重庆政企</a>
			</div>
		</div>
	</form>
</body>
</html>
